package com.danny.share

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.danny.componentbase.ServiceFactory
import com.danny.provider.RouterPath
import kotlinx.android.synthetic.main.activity_share.*
import org.jetbrains.anko.toast

//@Route(path = "/share/Share")
@Route(path = RouterPath.Share.PATH_SHARE)
class ShareActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_share)
        val content = intent!!.getStringExtra("share_content")
        share_content.text = content!!
        share()
    }

    private fun share() {
        if (ServiceFactory.serviceFactory.getAccountService().isLogin()){
            toast("分享成功")
        } else {
            toast("分享失败：用户未登录")
        }
    }

    fun shareLogin(view: View) {
        ARouter.getInstance().build(RouterPath.Login.PATH_LOGIN).navigation()
//        ARouter.getInstance().build("/account/login").navigation()
    }
}
